﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Home_ListBooks : System.Web.UI.Page
{
    public LanguageManage Language;
    public BookAdapter bookAdapter;
    UserEntity currentUser;
    public long catelogyID;
    public long platformID;
    protected void Page_Load(object sender, EventArgs e)
    {
        //Check login
        currentUser = UserManager.Instance.Getuser();
        if (!currentUser.isLogin)
            Response.Redirect("~/Login.aspx");
        Language = new LanguageManage();       
        if (Session["platformid"] == null)
        {
            if (Request.QueryString["catelogyid"] != null)
            {
                catelogyID = Convert.ToInt32(Request.QueryString["catelogyid"]);
                Session["menu_current"] = Session["menu_id"];
                Session["catelogyID"] = catelogyID;
                bookAdapter = new BookAdapter();
                List<BookEntity> list = bookAdapter.getListBook(catelogyID, currentUser);
                ListBook1.listBook = bookAdapter.getListBook(catelogyID, currentUser);
            }    
        }
        else
        {
            if (Request.QueryString["catelogyid"] != null)
            {
                catelogyID = Convert.ToInt32(Request.QueryString["catelogyid"]);
                Session["catelogyID"] = catelogyID;
                platformID =(long) Session["platformid"];
                bookAdapter = new BookAdapter();
                ListBook1.listBook = bookAdapter.getListBook(catelogyID, platformID, currentUser);
            }
        }
       
    }
}